<template>
  <el-card
    style="
      margin: 140px auto;
      background-color: #fff;
      width: 470px;
      height: 310px;
      padding: 10px;
      border-radius: 10px;
    "
  >
    <el-form
      label-width="120px"
      size="small"
      :model="form"
      :rules="rules"
      ref="pass"
    >
      <el-form-item label="活动名称:" prop="activityName">
        <el-input v-model="form.activityName" autocomplete="off"></el-input>
      </el-form-item>
      <el-form-item label="活动地址:" prop="activityArea">
        <el-input v-model="form.activityArea" autocomplete="off"></el-input>
      </el-form-item>
      <el-form-item label="活动规模:" prop="activityScale">
        <el-input v-model="form.activityScale" autocomplete="off"></el-input>
      </el-form-item>
      <el-form-item label="活动时间:" prop="activityTime">
        <el-input v-model="form.activityTime" autocomplete="off"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="save">确 定</el-button>
      </el-form-item>
    </el-form>
  </el-card>
</template>

<script>
export default {
  name: "Password",
  data() {
    return {
      form: {},
      user: localStorage.getItem("user")
        ? JSON.parse(localStorage.getItem("user"))
        : {},
    };
  },
  created() {
    this.getCampus().then((res) => {
      console.log("+++" + res.campusName);
      this.form.campusId = res.id;
      this.form.campusName = res.campusName;
    });
  },
  methods: {
    save() {
      this.request.post("/act/submit", this.form).then((res) => {
        this.$message.success("创建成功,已提交审核，请耐心等待");
      });
    },
    async getCampus() {
      return (await this.request.get("/campus/mycampus?uid=" + this.user.id))
        .data;
    },
  },
};
</script>

<style>
.avatar-uploader {
  text-align: center;
  padding-bottom: 10px;
}
.avatar-uploader .el-upload {
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.avatar-uploader .el-upload:hover {
  border-color: #409eff;
}
.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 138px;
  height: 138px;
  line-height: 138px;
  text-align: center;
}
.avatar {
  width: 138px;
  height: 138px;
  display: block;
}
</style>
